// 所有组织模块需要的接口
import request from '@/utils/request'
export const getDepart = () => {
  return request({
    url: "/company/department",
    method: "get"
  })
}

/**
 * 新增组织
 * code: "1112"  编码
    introduce: "对对对"  //描述
    managerId: 3 负责人id
    name: "运营1" 名称
    pid: 7  部门id
 * ***/
export function addDepartment (data) {
  return request({
    method: 'post',
    url: '/company/department',
    data
  })
}
/**
 *
 *  获取部门负责人的数据
 * **/

export function getManagerList () {
  return request({
    url: '/sys/user/simple'
  })
}


/** *
 * 更新部门
 * code: "1112"
    introduce: "对对对"
    managerId: 3
    name: "运营1"
    pid: 7 //父级id
    id：16//部门id
    createTime: "2024-11-27 02:46:58" //更新时间
 * ***/
export function updateDepartment (data) {
  return request({
    method: 'put',
    url: `/company/department/${data.id}`,
    data
  })
}

// 获取部门详情接口 回显
export function getDepartInfo (id) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'
  })
}

// 删除部门 
export function delDepart (id) {
  return request({
    url: `/company/department/${id}`,
    method: "delete"
  })
}